﻿import QtQuick 2.12
import QtQuick.Window 2.12
import TaoQuick 1.0
import Top 1.0

Window {
    id: rootWindow
    width: 1280
    height: 768
    visible: true
    title: qsTr("服务端")
    Column {
        anchors.fill: parent
        spacing: 10
        Item {
            height: 40
            width: 100
        }

        ClientInfoModel {
            width: parent.width * 0.9
            height: parent.height * 0.7
            anchors.horizontalCenter: parent.horizontalCenter
        }
        Row {
            anchors.horizontalCenter: parent.horizontalCenter
            spacing: 20
            CusButton {
                text: {
                    if(!GlobalManager.tcpManager.listenFlag) {
                        return "开始监听"
                    }else {
                        return "关闭监听"
                    }
                }

                width: 100
                height: 40
                anchors.verticalCenter: parent.verticalCenter
                onClicked: {
                    if(!GlobalManager.tcpManager.listenFlag)
                        GlobalManager.tcpManager.openListen()
                    else {
                        GlobalManager.tcpManager.closeListen();
                    }
                }
            }
        }
    }
}
